package com.gaofeng.day07;

import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.TreeMap;

public class demo6 {
    public static void main(String[] args) {
        // LinkedHashMap

        LinkedHashMap<String,Integer> lhm = new LinkedHashMap<>();
        lhm.put("a",123);
        lhm.put("a",111);
        lhm.put("b",456);
        lhm.put("c",789);

        System.out.println(lhm);

        //TreeMap
        TreeMap<Integer, String> tm = new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return 01 - 02;
            }
        });
        tm.put(1,"张三");
        tm.put(2,"李四");
        tm.put(3,"王五");


        System.out.println(tm);

    }
}
